Response Settings

Once you’ve set up the request settings, you need to set up the response as well. To do so, click the Response tab and make the necessary response settings as described in this section.

General Settings

Setting

Description

Scope

Allows you to define the context for the integration task. Global means that the integration task output will be saved in the global context, that is, the Response entity set on the connector action.

If you want to save the response in an entity different from the global one set on the connector action, than from the Scope field, select Local and from the Response entity field, select the desired entity.

Using the Local scope, you can do all related queries directly inside the connector action instead of building a larger context outside the connector action via additional queries within the Flow Designer to put data inside the request entity and then send the data back to the connector action.

Note:  The Scope field is available in DRUID 5.23 and higher.
Response entity The entity the bot will use to receive data from the external app and pass it into the conversation context. This field is automatically filled in with the Response Entity set on the selected REST Connector Action if the Scope is Global.
Response entity id collection This field is automatically ticked if the Response Entity set on the selected REST Connector Action, is expected to be a list of records.

Iterate by (JSON PATH Expression)

This is the JSON Path expression provided in the Request (if any). The field is automatically filled in, just for information purpose, because iteration will affect the response of the task, as well (if any).

Select token query The query which filters the response before fields mapping is executed, that is, before the response is mapped with DRUID fields. Provide the query in JSON Path format.
Response Body Content Type

The format of the data returned in the response body of a REST API call. It determines how the data is structured and interpreted. You can select from various content types such as JSON, XML, or Text, depending on the API's response format. Choosing the correct content type ensures proper handling and parsing of the response data during integration.

Note:  This field is available starting from DRUID version 7.16. In earlier versions, response types (Connector Field Type) were specified within the mapping table.
Map Entire JSON Payload
Note:  This feature is available in DRUID 8.2 and higher.

If the response body’s content type is JSON, you can map the entire JSON payload to a field of type jObject or jArray. To do this, enable Map Entire JSON Payload and from the JSON Field, select the DRUID jObject or jArray field that will store the JSON payload.

Project Result To Entity Path

Use it when you want to map the response directly to an Entity List type field.

Mapping response fields

The way you map response fields depends on the Response Body Content Type and the structure of the response.

Mapping Text responses

To map Text responses, follow these steps:

  1. From the Response Body Content Type field, select Text.
  2. In the mapping table, click the Add icon displayed inline with the mapping line.
  3. Leave the Connector field name empty.
  4. In the Druid entity field name, enter the entity field where you want to save the response as a string (e.g., [[Entity]].StringField).
  5. Click the Save icon next to the mapping line.
  6. Save the integration.

Example: Text response mapping

Mapping simple and structured JSON and XML responses

Important!  The structure of entities that capture the JSON object response should reflect the structure of the JSON data object that you map on the response.

To map a simple and structured JSON or XML response, follow these steps:

  1. From the Response Body Content Type field, select JSON or XML based on the expected response type.
  2. In the mapping table, click the Add icon next to the mapping line.
  3. In Connector field name enter the name of the property you want to map from the JSON or XML response.
  4. In the Druid entity field name, type [[, select the entity, then select the entity field where you want to store the property from the response.
  5. Hint:  You can specify Connector field names in the following native scripts: Latin, Greek, Hebrew, Simplified Chinese, Traditional Chinese, Japanese, Hindi and Arabic.
  6. Click the Save icon next to the mapping line.
  7. Save the integration.

Map JSON response as a string

There are cases when you might want to save the entire JSON content response as a string in a DRUID entity (without mapping the specific fields in the JSON content) and pass it to other external services.

To save the full JSON content as a string, follow these steps:

  1. From the Response Body Content Type field, select JSON or XML based on the expected response type.
  2. In the mapping table, click the Add icon next to the mapping line.
  3. Leave the Connector field name empty.
  4. Note:  You can specify keys (Connector field name field) in the following native scripts: Latin, Greek, Hebrew, Simplified Chinese, Traditional Chinese, Japanese, Hindi and Arabic.
  5. In the Druid entity field name, type [[, select the entity, then select the entity field where you want to save the full JSON response as string.
  6. Click the Save icon next to the mapping line.
  7. Save the integration task.
Hint:  The JSON object will be stringified and saved in the specified DRUID field.

Example: Full JSON content as string mapping

Handle complex XML responses

If a GET request returns an XML response with a complex or unstructured format that prevents direct field mapping, consider the following approach:

  1. From the Response Body Content Type field, select XML.
  2. Store the entire XML response as a string in a DRUID entity field.
  3. Hint:  The XML object will be stringified and saved in the specified DRUID field.
  4. Save the REST integration.
  5. Create a Custom Code integration after the REST integration to process the XML string.
  6. Use the 'Map XML string to Entity Fields' template within the Custom Code integration to map the desired XML data to DRUID entity fields.

Consume values from an entity that is global at the integration (connector action) level within an integration task with local scope

There may be scenarios where the response entity is both local and global, and it possesses distinct memory slots. You have the capability to retrieve values from a globally scoped entity at the integration (connector action) level within an integration task that has local scope.

For instance, consider a campaign scenario where an integration task with local scope is employed to create a new campaign sharing the same category as the campaign from the global entity. In the add/create integration task, referencing the [[Campaign]] with local scope, you can assign a new name and date while maintaining the category from the global entity's Campaign. To achieve this, map the relevant DRUID entity fields on the Response, assuming they exist: [[Campaign]].Name, [[Campaign]].CreationOn, and [[Campaign]]_Global.Category.